package com.bcqn.enums;

public enum FilePrefix {
    /**
     * 首页配置
     */
    CONFIG("config/", "首页配置");

    private final String value;
    private final String title;

    FilePrefix(String value, String title) {
        this.value = value;
        this.title = title;
    }

    public String value() {
        return value;
    }

    public String getValue() {
        return value;
    }

    public String getTitle() {
        return title;
    }

    public String getTitle(Integer value) {
        return of(value).title;
    }

    public static FilePrefix of(final Integer value) {
        for (FilePrefix e : FilePrefix.values()) {
            if (e.value != null && e.value.equals(value)) {
                return e;
            }
        }
        return null;
    }

    public static FilePrefix nameOf(final String title) {
        for (FilePrefix e : FilePrefix.values()) {
            if (e.title.equals(title.trim())) {
                return e;
            }
        }
        return null;
    }


    @Override
    public String toString() {
        return this.title;
    }
}
